package net.lab1024.sa.user.module.business.course.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.lab1024.sa.common.common.domain.PageResult;
import net.lab1024.sa.common.common.util.SmartPageUtil;
import net.lab1024.sa.user.module.business.course.dao.CoursePeriodDao;
import net.lab1024.sa.user.module.business.course.domain.form.CoursePeriodQueryForm;
import net.lab1024.sa.user.module.business.course.domain.vo.CoursePeriodVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程时段 Service
 *
 * @Author jabari
 * @Date 2023-08-05 16:49:34
 * @Copyright 51dev.cn
 */

@Service
public class CoursePeriodService {

    @Autowired
    private CoursePeriodDao coursePeriodDao;

    /**
     * 分页查询
     *
     * @param queryForm
     * @return
     */
    public PageResult<CoursePeriodVO> queryPage(CoursePeriodQueryForm queryForm) {
        Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
        List<CoursePeriodVO> list = coursePeriodDao.queryPage(page, queryForm);
        PageResult<CoursePeriodVO> pageResult = SmartPageUtil.convert2PageResult(page, list);
        return pageResult;
    }

    public List<CoursePeriodVO> getCoursePeriodVOList(List<Integer> courseIds){
        return coursePeriodDao.getCoursePeriodVOList(courseIds);
    }


}
